// 引入 axios
import axios from 'axios';
import { Message } from "element-ui";

// cp是全局变量，之前是通过使用process.env.NODE_ENV==='production'来判断打包的是哪一个路径，在tomcat下是..(由于在Tomcat是domain在obpm里面，但是要找到根目录的路径)，在本地是obpm
let contextPath = location.origin + "/" + cp

// axios.defaults.baseURL = "http://localhost:8080/";
/*
axios.get('/user?ID=12345')
  .then(function (response) {
    console.log(response);
  })
  .catch(function (error) {
    console.log(error);
  });

*/
// axios.defaults.withCredentials=true;
const instance = axios.create({
    // timeout: 5000, // 请求的超时时间
    //设置默认请求头，使post请求发送的是formdata格式数据// axios的header默认的Content-Type好像是'application/json;charset=UTF-8',我的项目都是用json格式传输，如果需要更改的话，可以用这种方式修改
    // headers: {  
    //   "Content-Type": "application/x-www-form-urlencoded"
        // 'Cache-Control':'no-cache',
        // 'fetchPolicy':'no-cache',
        // 'If-Modified-Since':'0'
    // },
    // withCredentials: true // 允许携带cookie
    //adminToken
    // headers: {
    //     "adminToken": window.adminToken
    // },

});
instance.interceptors.request.use(
    config => {
        if(config.method.toLowerCase() == 'put' || config.method.toLowerCase() == 'post'){
            // config.headers['adminToken'] = localStorage.getItem('adminToken');
            // if(config.data && config.data.loginpwd && config.data.loginpwd.length > 60){
            //     Message.error('密码长度不能大于60位')
            //     return false
            // }
            return config
        }else{
            // config.headers['adminToken'] = localStorage.getItem('adminToken');
            return config
        }
    },
    err => {
        return Promise.reject(err)
    }
);

//http response 拦截器
instance.interceptors.response.use(
    response => {
        console.log("axios.interceptors.response");
        return response;
    },
    error => {
        //未登录
        if (error.response.status == 401) {
            window.location = "index.html#/login";
        }
        else {
            return Promise.reject(error)
        }
    }
);

instance.defaults.withCredentials = true;

export default {
    /**
     * contextPath路径
     */
    getContextPath:function(){
        return contextPath;
    },
    /**
     * staticPath路径
     */
    getStaticPath: function(){
        return staticPath
    },
    /**
     * 登录
     * @param {} username 
     * @param {*} password 
     * @param {*} param2 
     */
    login: function (username, password, checkcode, { onSucess, onError }) {
        instance.post(contextPath + '/authtime/login', { username: username, password: password,checkcode:checkcode})
            .then(function (response) {
                if (onSucess) onSucess(response);
            }).catch(
                function (error) {
                    if (onError) onError(error);
                }
            );
    },

    genAccessToken: function (secret, { onSucess, onError }) {
        instance.get(`${contextPath}/rest/accessToken?secret=${secret}`)
            .then(function (response) {
                if (onSucess) onSucess(response);
            }).catch(
                function (error) {
                    if (onError) onError(error);
                }
            );
    },

    /**
     * 退出系统
     * 请求地址：/logout
     */
    LogOut: function ({ onSucess, onError }) {
        axios({
            url: contextPath + '/authtime/logout',
            method: 'post'
        }).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(function (error) {
            if (onError) onError(error);
        })
    },

    getDebugUrl:function(url){
        if(staticPath){
            return `${staticPath.replace(/\/api/,"")}`+url;
        }else{
            return contextPath+url;
        }
    },
    getSwaggerUrl:function(url){
        return contextPath.replace(/\/api/,"")+url;
    },
    getSystemUrl:function(url){
        return contextPath+url;
    },

    /**
     * 2.1获取域(租户)列表
     * /authtime/domains?currpage={currpage}&pagelines={pagelines}&name={name}&username={username}
     */
    getDomains: function ({currpage, pagelines,data},{ onSucess, onError }) {
        instance.post(`${contextPath}/authtime/domains?currpage=${currpage}&pagelines=${pagelines}`,data).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    monitorGetDomains: function ({currpage, pagelines,data}, currentService,{ onSucess, onError }) {
        instance.post(`${contextPath}/monitor/${currentService.host}${currentService.contextPath}/${currentService.port}/authtime/domains?currpage=${currpage}&pagelines=${pagelines}`,data).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    /**
     * 2.2获取域(租户)
     * /authtime/domains?currpage={currpage}&pagelines={pagelines}&name={name}&username={username}
     */
    getDomain: function (id, { onSucess, onError }) {
        instance.get(`${contextPath}/authtime/domain/${id}`).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },
    resetSecret: function (id, { onSucess, onError }) {
        instance.put(`${contextPath}/authtime/domain/${id}/secret`).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },
    /**
     * 
     * @param ### 2.3测试域(租户)短信发送
     **请求方式：** GET
     **请求地址：** /authtime/domain/{domainid}/sms/{telephone}
     * @param {*}  domainid
     */
    testSMS: function (domainid, telephone, { onSucess, onError }) {
        instance.get(`${contextPath}/authtime/domain/${domainid}/sms/${telephone}`).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    /**
     * 
     * @param ### 2.4获取域(租户)logo集合
     **请求方式：** GET
     **请求地址：** /authtime/icons
     * @param {*}  domainid
     */
    getLogos: function (path,{ onSucess, onError }) {
        instance.get(`${contextPath}/authtime/icons?path=${path}`).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },
    // getLogoUrl:function(files, url, path, { onSucess, onError }){
    //     let currentUrl = url + "?path="+path+"&icon=true" //&assToken=" + "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJhdXRoMCIsImV4cCI6MTYyODI1MTA2NiwidXNlcm5hbWUiOiJFcjZEaFpsYWZaZ3lsRnF0TW8yIn0.Z1E2zjBeTIr0m3fIfKVt1MCe0-G9COZkRLFUlnGurRI";
    //     if(staticPath){
    //         currentUrl =  `${contextPath}`+url;
    //     }else{
    //         currentUrl = `${contextPath.replace(/\/api/,"")}`+url;
    //     }
    //     instance.post(currentUrl,files).then(function (response) {
    //         if (onSucess) onSucess(response);
    //     }).catch(
    //         function (error) {
    //             if (onError) onError(error);
    //         }
    //     );

        // axios({
        //     headers: {
        //         "content-type": "multipart/form-data;boundary=" + Math.random()
        //     },
        //     data: files,
        //     url: `${contextPath.replace(/\/api/,"")}` + currentUrl,
        //     method: "post",
        // }).then(function (response) {
        //     if(onSucess) onSucess(response);
        // }).catch(
        //     function (error) {
        //         if(onError) onError(error);
        //     }
        // )  


    //     // return `${contextPath.replace(/\/api/,"")}`+url;
    // },
    getLogoUrl:function(url){
        return `${contextPath.replace(/\/api/,"")}`+url;
    },

    getFileUrl(url){
        if(staticPath){
            return `${contextPath}`+url;
        }else{
            return `${contextPath.replace(/\/api/,"")}`+url;
        }
    },

    getObpmUpload(applicationId) {
        return `/obpm/api/runtime/upload?applicationId=${applicationId}`
    },

    /**
     * 同步LDAP
     * @param {*} data 
     * @param {*} param1 
     */
    asyncLDAP: function (domainid, { onSucess, onError }) {
        instance.post(`${contextPath}/authtime/domain/synchldap?domainid=${domainid}`).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    /**
     * 
     * @param ### 2.5新建域(租户)基本信息
     **请求方式：** POST
     **请求地址：** /authtime/domain/} id 
     * @param {*} data 
     * @param {*} param2 
     */
    createDomain: function (data, { onSucess, onError }) {
        instance.post(`${contextPath}/authtime/domain`, data).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },


    /**
     * ### 2.6修改域(租户)基本信息
     **请求方式：** PUT
     **请求地址：** /authtime/domain/{id}
     */
    updateDomain: function (id, data, { onSucess, onError }) {
        instance.put(`${contextPath}/authtime/domain/${id}`, data).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    /**
     * ### 删除上级域接口
     **请求方式：** DELETE
     **请求地址：** /authtime/domain/{id}/relation
     */
    deleteRelation: function (domainid, { data } , { onSucess, onError }) {
        instance.delete(`${contextPath}/authtime/domain/${domainid}/relation`, { data: data }).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    /**
     * ### 2.7域(租户)用户导出
     **请求方式：** GET
     **请求地址：** /authtime/domain/{domainid}/user/export
     */
    exportUser: function (callback) {
        let url=`${obpmFilePath}${apiCenterPath}/admintools/users/export`
        window.open(url)
        callback();
    },

    /**
     * 下载模板
     *  */
    installTemplate:function(name){ 
        let url
        if(staticPath){
            url = `${obpmFilePath}/uploads/resource/${name}导入模板.xlsx`
        }else{
            url = `${obpmFilePath}/uploads/resource/${name}导入模板.xlsx`
        }
        window.open(url)
    },

    /**
     * ### 2.8域(租户)用户导入
     **请求方式：** POST
     **请求地址：** /authtime/domain/{domainid}/user/import?path={path}
     */
    importUser: function (data,{ onSucess, onError }) {
        // {headers:{'Content-Type': 'application/json;charset=UTF-8'}}
        instance.post(`${obpmFilePath}${apiCenterPath}/admintools/users/import`,data).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        ); 
    },

    /**
     * ### 2.9删除域(租户)
     **请求方式：** DELETE
     **请求地址：** /authtime/domain/{domainid}
     * @param {*} param0 
     * @param {*} param1 
     */
    deleteDomain: function (ids, { onSucess, onError }) {
        instance.delete(`${contextPath}/authtime/domain`, {data: ids}).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },
    

    /**
     * ### 2.10删除自定义图标
     **请求方式：** DELETE
     **请求地址：** /authtime/icon
     * @param {*} param0 
     * @param {*} param1 
     */
    deleteUpLogo: function ({data}, { onSucess, onError }) {
        instance.delete(`${contextPath}/authtime/icon`,{data:data}).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    getSkins: function ( { onSucess, onError }) {
        instance.get(`${contextPath}/authtime/skins`).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    /**
     * 3.1获取根部门
     * 请求方式：** GET  
     **请求地址：/authtime/domain/{domainid}/department/root
     */
    getRootDepartment: function ({ onSucess, onError }) {
        instance.get(`${obpmFilePath}${apiCenterPath}/admintools/departments/root`).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    /**
     * ### 3.1获取子部门
    **请求方式：** GET  
    **请求地址：/authtime/domain/{domainid}/department/{departmentid}/subdepartments
     */
    getSubDepartmentNodes: function (departmentid, { onSucess, onError }) {
        // instance.get(`${contextPath}/authtime/domain/${domainid}/department/${departmentid}/subdepartments?valid=${valid}`).then(function (response) {
        //     if (onSucess) onSucess(response);
        // }).catch(
        //     function (error) {
        //         if (onError) onError(error);
        //     }
        // );
        instance.get(`${obpmFilePath}${apiCenterPath}/admintools/departments/`+departmentid+'/childs').then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    /**
     * ### 3.2获取部门详情
     **请求方式：** GET  
     **请求地址：** /authtime/department/{id}
     */
    getDepartment: function (id, { onSucess, onError }) {
        instance.get(`${contextPath}/authtime/department/${id}`).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    /**
     * 
     * @param ### 3.3新建部门信息
     **请求方式：** POST
     **请求地址：** /authtime/domain/{domainid}/department
     * @param {*} param1 
     */
    createDepartment: function ({ data }, { onSucess, onError }) {
        instance.post(`${obpmFilePath}${apiCenterPath}/admintools/departments`, data).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
        // instance.post(`${contextPath}/authtime/domain/${domainid}/department`, data).then(function (response) {
        //     if (onSucess) onSucess(response);
        // }).catch(
        //     function (error) {
        //         if (onError) onError(error);
        //     }
        // );
    },

    /**
     * 
     * @param ### 3.4更新部门信息
     **请求方式：** PUT
     **请求地址：** /authtime/domain/{domainid}/department/{id}
     * @param {*} param1 
     */
    updateDepartment: function ({departmentid, data }, { onSucess, onError }) {
        instance.post(`${obpmFilePath}${apiCenterPath}/admintools/departments/${departmentid}`, data).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    /**
     * ### 3.5查询对应部门列表
     **请求方式：** POST  
     **请求地址：** /authtime/domain/{domainid}/departments?currpage={currpage}&pagelines={pagelines}&superiorid={superiorid}&orderby ={orderby}&valid={valid}
     */
    getSubDepartments: function ({ superiorid, currpage, pagelines,valid,data }, { onSucess, onError }) {
        let name = data.name
        // instance.post(`${contextPath}/authtime/domain/${domainid}/departments?currpage=${currpage}&pagelines=${pagelines}&superiorid=${superiorid}&orderby =${orderby}&valid=${valid}`,data).then(function (response) {
        //     if (onSucess) onSucess(response);
        // }).catch(
        //     function (error) {
        //         if (onError) onError(error);
        //     }
        // );
        instance.get(`${obpmFilePath}${apiCenterPath}/admintools/departments?superiorId=`+ superiorid+'&name='+name + '&currpage='+currpage+'&pagelines='+pagelines+ '&valid='+valid,).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },


    /**
     * ### 3.6删除部门
     **请求方式：** DELETE
     **请求地址：** /authtime/department
     * @param {*} param0 
     * @param {*} param1 
     */
    deleteDepartment: function ({ data }, { onSucess, onError }) {
        instance.delete(`${obpmFilePath}${apiCenterPath}/admintools/departments`, { data: data }).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    /**
     * ### 3.7 部门下用户
     **请求方式：** GET
     **请求地址：** /authtime/department/{departmentid}/users
     */
    getDepartmentUsers: function (departmentid,{ currpage, pagelines }, { onSucess, onError }) {
        instance.get(`${obpmFilePath}${apiCenterPath}/admintools/departments/`+departmentid+'/users?currpage='+currpage + '&pagelines='+pagelines).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },
    /**
     * ### 3.8部门导入
     **请求方式：** POST  
     **请求地址：**   /authtime/domain/{domainid}/department/import?path={path}
     */
    departmentImport: function ( path, { onSucess, onError }) {
        instance.post(`${obpmFilePath}${apiCenterPath}/admintools/departments/import?path=${path}`).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    /**
     * ### 4.1查询域(租户)用户列表
     **请求方式：** POST  
     **请求地址：**  /authtime/domain/{domainid}/users?username={username}&applicationid={applicationid}&loginno={loginno}&roleid={roleid}&superiorname={superiorname}&departmentid={departmentid}&orderby={orderby}&currpage={currpage}&lines={lines} 
     */
    getUsers: function ({departmentid, currpage, pagelines,data }, { onSucess, onError }) {
        let searchWord = data.searchWord
        let status = data.status
        instance.get(`${obpmFilePath}${apiCenterPath}/admintools/users?searchWord=${searchWord}&departmentId=${departmentid}&currpage=${currpage}&pagelines=${pagelines}&status=${status}`).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

     /**
     * 
     * @param ### 4.4获取指定用户部门角色和km角色关系
     **请求方式：** GET
     **请求地址：** /authtime/user/{userid}/rolewithdeptandkmrelation
     * @param {*} param1 
     */
    getDeptUser: function (userid, { onSucess, onError }) {
        axios.get(`${obpmFilePath}${apiCenterPath}/admintools/users/${userid}/rolewithdeptandkmrelation?timer=${Date.parse(new Date())/1000}`).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },


    /**
     * 
     * @param ### 4.5创建用户
     **请求方式：** POST
     **请求地址：** /authtime/domain/{domainid}/user
     * @param {*} param1 
     */
    createUser: function ({data }, { onSucess, onError }) {
        instance.post(`${obpmFilePath}${apiCenterPath}/admintools/users`, data).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    /**
     * ### 4.6更新用户
     **请求方式：** PUT
     **请求地址：** /authtime/domain/{domainid}/user/{id}
     */
    updateUser: function ({ userid, data }, { onSucess, onError }) {
        instance.post(`${obpmFilePath}${apiCenterPath}/admintools/users/${userid}`, data).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    /**
     * ### 4.7用户删除
     **请求方式：** DELETE
     **请求地址：** /authtime/user
     * @param {*} param0 
     * @param {*} param1 
     */
    deleteUser: function ({ data }, { onSucess, onError }) {
        instance.delete(`${obpmFilePath}${apiCenterPath}/admintools/users`, { data: data }).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    /**
     * ### 4.8给角色批量添加用户
     **请求方式：** POST
     **请求地址：**  /authtime/user/batch
     * @param {*} param0 
     * @param {*} param1 
     */
    batchUser: function (data , { onSucess, onError }) {
        instance.post(`${contextPath}/authtime/user/batch`, data).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },
    /**
     * 
     * @param ### 4.9批量废置用户
     **请求方式：** PUT
     **请求地址：** /authtime/user/abandonment
     * @param {*} param1 
     */
    abandonment: function (data, { onSucess, onError }) {
        instance.delete(`${obpmFilePath}${apiCenterPath}/admintools/users/abandonment`, data).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },
    /**
     * 
     * @param ### 4.10根据账号获取指定用户
     **请求方式：** PUT
     **请求地址：** /authtime/domain/{domainid}/user?loginNo={loginNo}
     * @param {*} param1 
     */
     getLoginNo: function ({loginNo}, { onSucess, onError }) {
        instance.get(`${obpmFilePath}${apiCenterPath}/admintools/users/findbyloginno?loginNo=${loginNo}`).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },
    /**
     * ### 5.1获取角色列表
     **请求方式：** POST
     **请求地址：** /authime/application/{applicationid}/roles?currpage={currpage}&pagelines={pagelines}
     */
    getRoleList: function ({ applicationid,currpage=1,pagelines=10,data={name:''}}, { onSucess, onError }) {
        instance.post(`${obpmFilePath}${apiCenterPath}/admintools/applications/${applicationid}/roles?currpage=${currpage}&pagelines=${pagelines}`,data).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    /**
     * ### 10.1查询工作日历列表
     **请求方式：** POST  
     **请求地址：** /authtime/domain/{domainid}/calendars?currpage={currpage}&pagelines={pagelines}
     */
    getCalendars: function ({currpage, pagelines}, { onSucess, onError }) {
        instance.post(`${obpmFilePath}${apiCenterPath}/admintools/calendars?currpage=${currpage}&pagelines=${pagelines}`).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    /**
     * ### 6.1获取软件配置
     **请求方式：** GET  
     **请求地址：** /authtime/domain/{domainid}/defaultapp
     */
    getSystemAppConfig: function ({ domainid }, { onSucess, onError }) {
        instance.get(`${contextPath}/authtime/domain/${domainid}/defaultapp`).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },


    /**
     * ### 6.1启用系统软件配置(4.4 版本)
     **请求方式：** PUT
     **请求地址：** /authtime/domain/{domainid}/defaultapp/{module}/enable
     * @param {*} param0 
     * @param {*} param1 
     */
    enableSystemApplicationConfig: function ({ domainid, module }, { onSucess, onError }) {
        instance.put(`${contextPath}/authtime/domain/${domainid}/defaultapp/${module}/enable`).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },
    /**
     * ### 6.1启用系统软件配置(5.0 版本)
     **请求方式：** PUT
     **请求地址：** /authtime/domain/{domainid}/defaultapp/{id}/enable
     * @param {*} param0 
     * @param {*} param1 
     */
    enableSysAppConfig: function ({ domainid, id }, { onSucess, onError }) {
        instance.put(`${contextPath}/authtime/domain/${domainid}/defaultapp/${id}/enable`).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    /**
     * ### 6.2禁用系统软件配置(4.4)
     **请求方式：** PUT
     **请求地址：** /authtime/domain/{domainid}/defaultapp/{module}/disable
     * @param {*} param0 
     * @param {*} param1 
     */
    disableSystemApplicationConfig: function ({ domainid, module }, { onSucess, onError }) {
        instance.put(`${contextPath}/authtime/domain/${domainid}/defaultapp/${module}/disable`).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    /**
     * ### 6.2禁用系统软件配置(5.0)
     **请求方式：** PUT
     **请求地址：** /authtime/domain/{domainid}/defaultapp/{id}/disable
     * @param {*} param0 
     * @param {*} param1 
     */
    disableSysAppConfig: function ({ domainid, id }, { onSucess, onError }) {
        instance.put(`${contextPath}/authtime/domain/${domainid}/defaultapp/${id}/disable`).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    /**
     * ### 6.4域(租户)软件列表
     **请求方式：** POST  
     **请求地址：** /authtime/domain/{domainid}/applications/bind
     */
    getCustomAppConfig: function ({data, currpage=1, pagelines=10 }, { onSucess, onError }) {
        let name = data.name
        instance.get(`${obpmFilePath}${apiCenterPath}/admintools/applications/bind?name=${name}&currpage=${currpage}&pagelines=${pagelines}`).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    /**
     * ### 6.5查询未添加软件列表
     **请求方式：** POST  
     **请求地址：** /authtime/domain/{domainid}/applications/unbind
     */
    getUnbindApps: function ({data, currpage=1, pagelines=10000}, { onSucess, onError }) {
        let name = data.name
        instance.get(`${obpmFilePath}${apiCenterPath}/admintools/applications/unbind?name=${name}&currpage=${currpage}&pagelines=${pagelines}`,data).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    /**
     * ### 添加软件
     **请求方式：** PUT
     **请求地址：** /authtime/domain/{domainid}/application
     * @param {*} param0 
     * @param {*} param1 
     */
    bindCustomApps: function ({data }, { onSucess, onError }) {
        instance.post(`${obpmFilePath}${apiCenterPath}/admintools/applications`, data).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    /**
     * ### 移除软件
     **请求方式：** DELETE
     **请求地址：** /authtime/domain/{domainid}/application
     * @param {*} param0 
     * @param {*} param1 
     */
    unbindCustomApps: function ({data }, { onSucess, onError }) {
        instance.delete(`${obpmFilePath}${apiCenterPath}/admintools/applications`, { data: data }).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    /**
     * ### 6.6保存km角色管理
     **请求方式：** PUT
     **请求地址：** /authtime/domain/{domainid}/savekmconfig
     * @param {*} param0 
     * @param {*} param1 
     */
    updatekmconfig: function({ domainid, data }, { onSucess, onError }){
        instance.put(`${contextPath}/authtime/domain/${domainid}/savekmconfig`, data).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
        });
    },

    /**
     * ### 6.7查询所有软件列表
     **请求方式：** GET
     **请求地址：** /authtime/applications?name={name}
     * @param {*} param0 
     * @param {*} param1 
     */
    getCustomApps: function({ onSucess, onError }){
        instance.get(`${contextPath}/authtime/applications?pagelines=100000`).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
        });
    },

    momitorGetCustomApps:function(currentService,{ onSucess, onError }){
        instance.get(`${contextPath}/monitor/${currentService.host}${currentService.contextPath}/${currentService.port}/authtime/applications?pagelines=100000`).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
        });
    },
    /**
     * ### 6.8查询所有软件列表系统管理
     **请求方式：** GET
     **请求地址：** /authtime/config/applications
     * @param {*} param0 
     * @param {*} param1 
     */
     getCustomAllApps: function( { onSucess, onError }){
        instance.get(`${contextPath}/authtime/applications?name=`).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
        });
    },

    /**
     * ### 7.1微信配置
     **请求方式：** GET  
     **请求地址：** /authtime/domain/{domainid}/wechat
     * @param {*} param0 
     * @param {*} param1 
     */
    getWechatConfig: function ({ domainid }, { onSucess, onError }) {
        instance.get(`${contextPath}/authtime/domain/${domainid}/wechat`).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    /**
     * ### 7.2保存微信配置
     **请求方式：** PUT
     **请求地址：** /authtime/domain/{domainid}/wechat
     * @param {*} param0 
     * @param {*} param1 
     */
    updateWechatConfig: function ({ domainid, data }, { onSucess, onError }) {
        instance.put(`${contextPath}/authtime/domain/${domainid}/wechat`, data).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    /**
     * ### 7.3外网访问地址验证
     **请求方式：** GET  
     **请求地址：** /authtime/domain/{domainid}/wechat/corp/{corpid}/corpsecret/{corpsecret}
     * @param {*} param0 
     * @param {*} param1 
     */
    verifyWechatConfig: function ({ domainid, corpid, corpsecret }, { onSucess, onError }) {
        instance.get(`${contextPath}/authtime/domain/${domainid}/wechat/corp/${corpid}/corpsecret/${corpsecret}`).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    /**
     * ### 7.4是否显示企业微信同步到域(租户)的按钮
     **请求方式：** Get
     **请求地址：** /authtime/weixin/synchronization/show
     * @param {*} param0 
     * @param {*} param1 
     */
    isShowsynFromWeixin: function ( { onSucess, onError }) {
        instance.get(`${contextPath}/authtime/weixin/synchronization/show`).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    /**
     * ### 7.5同步域(租户)组织架构到微信企业号
     **请求方式：** PUT
     **请求地址：** /authtime/domain/{domainid}/synch2wechat
     * @param {*} param0 
     * @param {*} param1 
     */
    sync2Weixin: function ({ domainid, data }, { onSucess, onError }) {
        instance.put(`${contextPath}/authtime/domain/${domainid}/synch2wechat`, data).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    /**
     * ### 7.6同步微信企业号组织架构到域(租户)
     **请求方式：** PUT
     **请求地址：** /authtime/domain/{domainid}/synchfromwechat
     * @param {*} param0 
     * @param {*} param1 
     */
    synFromWeixin: function ({ domainid, data }, { onSucess, onError }) {
        instance.put(`${contextPath}/authtime/domain/${domainid}/synchfromwechat`, data).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    /**
     * ### 7.7生成跳转链接
     **请求方式：** GET  
     **请求地址 :******** /authtime/domain/{domainid}/application/{applicationid}/getwechaturl
     * @param {*} param0 
     * @param {*} param1 
     */
    genWeChatURL: function ({ domainid ,applicationid }, { onSucess, onError }) {
        instance.get(`${contextPath}/authtime/domain/${domainid}/application/${applicationid}/getwechaturl`).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

     /**
     * ### 7.8保存微信应用AgentId
     **请求方式：** PUT  
     **请求地址 :******** /authtime/domain/{domainid}/application/{applicationid}/updateWeixinAgentId?id={id}
     * @param {*} param0 
     * @param {*} param1 
     */
    saveAgentId: function ({ domainid ,applicationid,id}, { onSucess, onError }) {
        instance.put(`${contextPath}/authtime/domain/${domainid}/application/${applicationid}/updateWeixinAgentId?id=${id}`).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    /**
     * ### 7.9保存微信应用secret
     **请求方式：** PUT  
     **请求地址 :******** /authtime/domain/{domainid}/application/{applicationid}/updateWeixinSecret?secret={secret}
     * @param {*} param0 
     * @param {*} param1 
     */
    saveSecret: function ({ domainid ,applicationid,secret}, { onSucess, onError }) {
        instance.put(`${contextPath}/authtime/domain/${domainid}/application/${applicationid}/updateWeixinSecret?secret=${secret}`).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    /**
     * ### 8.1获取钉钉配置
     **请求方式：** GET  
     **请求地址：** /authtime/domain/{domainid}/dingding
     * @param {*} param0 
     * @param {*} param1 
     */
    getDingConfig: function ({ domainid }, { onSucess, onError }) {
        instance.get(`${contextPath}/authtime/domain/${domainid}/dingding`).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    /**
     * ### 8.2保存钉钉配置
     **请求方式：** PUT
     **请求地址：** /authtime/domain/{domainid}/dingding
     * @param {*} param0 
     * @param {*} param1 
     */
    updateDingConfig: function ({ domainid, data }, { onSucess, onError }) {
        instance.put(`${contextPath}/authtime/domain/${domainid}/dingding`, data).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    /**
     * ### 8.3钉钉外网访问地址验证
     **请求方式：** GET  
     **请求地址：** /authtime/domain/{domainid}/dingding/appkey/{appkey}/appsecret/{appsecret}
     * @param {*} param0 
     * @param {*} param1 
     */
    verifyDingConfig: function ({ domainid, appkey, appsecret }, { onSucess, onError }) {
        instance.get(`${contextPath}/authtime/domain/${domainid}/dingding/appkey/${appkey}/appsecret/${appsecret}`).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    /**
     * ### 8.4同步域(租户)组织架构到钉钉
     **请求方式：** PUT
     **请求地址：** /authtime/domain/{domainid}/synch2dingding
     * @param {*} param0 
     * @param {*} param1 
     */
    sync2Ding: function ({ domainid }, { onSucess, onError }) {
        instance.put(`${contextPath}/authtime/domain/${domainid}/synch2dingding`).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    /**
     * ### 8.5同步钉钉组织架构到域(租户)
     **请求方式：** PUT
     **请求地址：** /authtime/domain/{domainid}/synchfromdingding
     * @param {*} param0 
     * @param {*} param1 
     */
    synFromDing: function ({ domainid}, { onSucess, onError }) {
        instance.put(`${contextPath}/authtime/domain/${domainid}/synchfromdingding`).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    /**
     * ### 8.6生成跳转链接
     **请求方式：** GET  
     **请求地址 :******** /domain/{domainid}/application/{applicationid}/getdingdingurl
     * @param {*} param0 
     * @param {*} param1 
     */
    genDingURL: function ({ domainid ,applicationid }, { onSucess, onError }) {
        instance.get(`${contextPath}/authtime/domain/${domainid}/application/${applicationid}/getdingdingurl`).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

     /**
     * ### 8.7更新钉钉应用AgentId
     **请求方式：** PUT  
     **请求地址 :******** /authtime/domain/{domainid}/application/{applicationid}/updatedingdingagentId?id={id}
     * @param {*} param0 
     * @param {*} param1 
     */
    saveDingAgentId: function ({ domainid ,applicationid,id}, { onSucess, onError }) {
        instance.put(`${contextPath}/authtime/domain/${domainid}/application/${applicationid}/updatedingdingagentid?id=${id}`).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    /**
     * ### 8.8更新钉钉应用appSecret
     **请求方式：** PUT  
     **请求地址 :******** /authtime/domain/{domainid}/application/{applicationid}/updatedingdingsecret?appsecret={secret}
     * @param {*} param0 
     * @param {*} param1 
     */
    saveDingSecret: function ({ domainid ,applicationid,secret}, { onSucess, onError }) {
        instance.put(`${contextPath}/authtime/domain/${domainid}/application/${applicationid}/updatedingdingappsecret?appsecret=${secret}`).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    /**
     * ### 8.9更新钉钉应用appKey
     **请求方式：** PUT  
     **请求地址 :******** /authtime/domain/{domainid}/application/{applicationid}/updatedingdingappkey?appkey={appkey}
     * @param {*} param0 
     * @param {*} param1 
     */
    saveDingAppkey: function ({ domainid ,applicationid,appkey}, { onSucess, onError }) {
        instance.put(`${contextPath}/authtime/domain/${domainid}/application/${applicationid}/updatedingdingappkey?appkey=${appkey}`).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    /**
     * ### 9.1获取管理员列表
     **请求方式：** POST  
     **请求地址：** /authtime/domain/{domainid}/admins?name={name}
     */
    getDomainManagers: function ({ domainid, currpage,pagelines,data}, { onSucess, onError }) {
        instance.post(`${contextPath}/authtime/domain/${domainid}/admins?currpage=${currpage}&pagelines=${pagelines}`,data).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    /**
     * ### 9.2添加管理员
     **请求方式：** PUT  
     **请求地址：** /authtime/domain/{domainid}/admin
     * @param {*} param0 
     * @param {*} param1 
     */
    addDomainManagers: function ({ domainid, data }, { onSucess, onError }) {
        instance.put(`${contextPath}/authtime/domain/${domainid}/admin`, data).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    /**
     * ### 9.3移除管理员
     **请求方式：** DELETE
     **请求地址：** /authtime/domain/{domainid}/admin
     * @param {*} domainid 
     */
    deleteDomainManagers: function (domainid, { data }, { onSucess, onError }) {
        instance.delete(`${contextPath}/authtime/domain/${domainid}/admin`, { data: data }).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    /**
     * ### 9.4获取不是管理员的用户列表
     **请求方式：** POST  
     **请求地址：** /authtime/domain/{domainid}/notadmins?currpage={currpage}&pagelines={pagelines}

     */
    getnoDomainManagers: function ({ domainid,currpage,pagelines,data}, { onSucess, onError }) {
        instance.post(`${contextPath}/authtime/domain/${domainid}/notadmins?currpage=${currpage}&pagelines=${pagelines}`,data).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    /**
     * ### 10.1查询工作日历列表
     **请求方式：** GET  
     **请求地址：** /authtime/domain/{domainid}/calendars?currpage={currpage}&pagelines={pagelines}
     */
    getDomainCalendars: function ({ domainid , currpage, pagelines,data}, { onSucess, onError }) {
        instance.post(`${contextPath}/authtime/domain/${domainid}/calendars?currpage=${currpage}&pagelines=${pagelines}`,data).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    /**
     * ### 10.2新建工作日历
     **请求方式：** POST  
     **请求地址：** /authtime/domain/{domainid}/calendar
     */
    newCalendars: function ( domainid, data, { onSucess, onError }) {
        instance.post(`${contextPath}/authtime/domain/${domainid}/calendar`,data).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    /**
     * ### 10.3更新工作日历
     **请求方式：** PUT  
     **请求地址：** /authtime/domain/{domainid}/calendar/{id}
     */
    updataCalendars: function ( domainid,id, data, { onSucess, onError }) {
        instance.put(`${contextPath}/authtime/domain/${domainid}/calendar/${id}`,data).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

     /**
     * ### 10.4删除工作日历
     **请求方式：** DELETE
     **请求地址：** /authtime/calendar
     * @param {*} param0 
     * @param {*} param1 
     */
    deleteCalendars: function ({ domainid, data }, { onSucess, onError }) {
        instance.delete(`${contextPath}/authtime/domain/${domainid}/calendar`, { data: data }).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    /**
     * ### 10.5 编辑日历
     **请求方式：** GET  
     **请求地址：** /authtime/domain/{domainid}/getworkcalendars
     */
    getEditCalendars: function ({ domainid }, { onSucess, onError }) {
        instance.get(`${contextPath}/authtime/domain/${domainid}/getworkcalendars`).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    /**
     * ### 10.6获取工作周列表
     **请求方式：** GET  
     **请求地址：** /authtime/domain/{domainid}/calendar/{id}/getstandardday
     */
    getStandardDay: function ({ domainid,id}, { onSucess, onError }) {
        instance.get(`${contextPath}/authtime/domain/${domainid}/calendar/${id}/getstandardday`).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    /**
     * ### 10.7保存工作周
     **请求方式：** PUT 
     **请求地址：** /authtime/domain/{domainid}/calendar/{id}/savestandardday
     */
    saveStandardDay: function ({ domainid,id,data}, { onSucess, onError }) {
        instance.put(`${contextPath}/authtime/domain/${domainid}/calendar/${id}/savestandardday`,data).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    /**
     * ### 10.8获取例外日列表
     **请求方式：** GET  
     **请求地址：** /authtime/domain/{domainid}/calendar/{id}/getspecialday?currpage={currpage}&
     */
    getSpecialDay: function ({ domainid,id,currpage,pagelines}, { onSucess, onError }) {
        instance.get(`${contextPath}/authtime/domain/${domainid}/calendar/${id}/getspecialday?currpage=${currpage}&pagelines=${pagelines}`).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    /**
     * ### 10.9保存例外日
     **请求方式：** PUT 
     **请求地址：** /authtime/domain/{domainid}/calendar/{id}/savespecialday
     */
    saveSpecialDay: function ({ domainid,id,data}, { onSucess, onError }) {
        instance.put(`${contextPath}/authtime/domain/${domainid}/calendar/${id}/savespecialday`,data).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    /**
     * ### 10.10新建例外日
     **请求方式：** POST
     **请求地址：** /authtime/domain/{domainid}/calendar/{id}/addspecialday
     */
    addSpecialDay: function ({ domainid,id,data}, { onSucess, onError }) {
        instance.post(`${contextPath}/authtime/domain/${domainid}/calendar/${id}/addspecialday`,data).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    /**
     * ### 10.11删除例外日
     **请求方式：** DELETE
     **请求地址：** /authtime/domain/calendar/deletespecialday
     * @param {*} param0 
     * @param {*} param1 
     */
    deleteSpecialDay: function ( data,{ onSucess, onError }) {
        instance.delete(`${contextPath}/authtime/domain/calendar/deletespecialday`,data).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    /**
     * ### 10.12工作日历详情
     **请求方式：** GET  
     **请求地址：** /domain/calendar/{id}/viewcalender?years={years}&month={month}&day={day}
     */
    getCalendarsDetail: function ( id,years,month,day, { onSucess, onError }) {
        instance.get(`${contextPath}/authtime/domain/calendar/${id}/viewcalender?years=${years}&month=${month}&day=${day}`).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    /**
     * ### 11.1查询扩展字段列表
     **请求方式：** POST  
     **请求地址：** /authtime/domain/{domainid}/fieldextends?type={type}&fortable={fortable}&currpage={currpage}&pagelines={pagelines}
     */
    getFieldExtends: function (data, { onSucess, onError }) {
        instance.post(`${contextPath}/authtime/domain/fieldextends?currpage=${data.currpage}&pagelines=${data.pagelines}`,data.data).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    /**
     * ### 11.2新建扩展字段
     **请求方式：** POST
     **请求地址：** /authtime/domain/{domainid}/fieldextend
     * @param {*} param0 
     * @param {*} param1 
     */
    createFieldExtend: function ({ data }, { onSucess, onError }) {
        instance.post(`${contextPath}/authtime/domain/fieldextend`, data).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    /**
     * ### 11.3更新扩展字段
     **请求方式：** PUT
     **请求地址：** /authtime/domain/{domainid}/fieldextend/{id}
     * @param {*} param0 
     * @param {*} param1 
     */
    updateFieldExtend: function ({ fieldexid, data }, { onSucess, onError }) {
        instance.put(`${contextPath}/authtime/domain/fieldextend/${fieldexid}`, data).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    /**
     * ### 11.4删除扩展字段
     **请求方式：** DELETE
     **请求地址：** /authtime/domain/{domainid}/fieldextend
     * @param {*} param0 
     * @param {*} param1 
     */
    deleteFieldExtend: function (domainid,{ data }, { onSucess, onError }) {
        instance.delete(`${contextPath}/authtime/domain/fieldextend?domainid=${domainid}`, { data: data }).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    /**
     * 
     * @param ### 11.5获取未使用字段
     **请求方式：** GET
     **请求地址：** /authtime/domain/{domainid}/getunusefields
     * @param {*}  domainid
     */
    getUnuserField: function (type,fortable,domainid, { onSucess, onError }) {
        instance.get(`${contextPath}/authtime/domain/getunusefields?type=${type}&fortable=${fortable}&domainid=${domainid}`).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    /**
     * ### 12.1查询操作日记列表
     **请求方式：** POST 
     **请求方式：** /authtime/domain/{domainid}/loggers?operator={operator}&ip={ip}&date={date}&currpage={currpage}&pagelines={pagelines}
     */
    getUserLogs: function ({ domainid, currpage, pagelines,data }, { onSucess, onError }) {
        instance.post(`${contextPath}/authtime/domain/${domainid}/loggers?currpage=${currpage}&pagelines=${pagelines}`,data).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    /**
     * ### 12.2更新操作日记是否记录
     **请求方式：** PUT
     **请求方式：** /authtime/domain/{domainid}/logger
     */
    updateUserLogs: function (domainid, data, { onSucess, onError }) {
        instance.put(`${contextPath}/authtime/domain/${domainid}/logger`, data).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    
    /**
     * ### 12.3删除操作记录
     **请求方式：** DELETE
     **请求地址：** /authtime/domain/{domainid}/loggers
     * @param {*} param0 
     * @param {*} param1 
     */
     deleteLogdata: function (domainid,{ data }, { onSucess, onError }) {
        instance.delete(`${contextPath}/authtime/domain/${domainid}/loggers`, { data: data }).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },


    /**
     * ### 12.4查询操作日记是否记录
     **请求方式：** GET
     **请求方式：** /authtime/domain/{domainid}/logger
     */
    getUserLogIslog: function (domainid,{ onSucess, onError }) {
        instance.get(`${contextPath}/authtime/domain/${domainid}/logger`, ).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },
    /**
     * ### 12.3导出操作记录
     **请求方式：** GET
     **请求地址：** authtime/domain/uumsxrgm1KEEqSZIoHs/logger/export?operator=&date=&ip=
     * @param {*} param0 
     * @param {*} param1 
     */
    exportExcelLog: function (domainid, params, callback) {
        let url=`${contextPath}/authtime/domain/${domainid}/logger/export?operator=${params.operator}&date=${params.date}&ip=${params.ip}`
        window.open(url)
        callback();
    },
    
    

    /**
     * ### 13.1查询流程监控列表
     **请求方式：** POST
     **请求地址：** /authtime/domain/{domainid}/workflow/flowstaterts?application={application}&_flowName={flowname}&_stateLabel={statelabel}&_initiator={initiator}&_firstProcessTime={firstprocesstime}&_lastProcessTime={lastprocesstime}&_lastAuditor={lastauditor}&_summary={summary}&currpage={currpage}&pagelines={pagelines}
     */
    getFlowstaterts: function({ domainid,currpage,pagelines,data},{ onSucess, onError }){
        instance.post(`${contextPath}/authtime/domain/${domainid}/workflow/flowstaterts?currpage=${currpage}&pagelines=${pagelines}`,data).then(function (response){
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    /**
     * 更新指定审批人
     * /authtime/domain/workflow/approvers/batch
     */
    updateBatchUser: function( data , { onSucess, onError }){
        instance.put(`${contextPath}/authtime/domain/workflow/approvers/batch`, data).then(function(response){
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    /**
     * ### 13.2删除流程实例
     **请求方式：** DELETE
     **请求地址：/authtime/domain/applicationid/{applicationid}/workflow/flowstaterts
     * @param {*} domainid 
     * @param {*} param1 
     */
    deleteFlowstaterts: function({ applicationid, data }, { onSucess, onError }){
        instance.delete(`${contextPath}/authtime/domain/applicationid/${applicationid}/workflow/flowstaterts`, { data: data }).then(function(response){
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    /**
     * ### 13.3流程节点耗时
     **请求方式：** GET
     **请求地址：** /authtime/domain/{domainid}/applicationid/{applicationid}/workflow/flowAndNodeTimeConsuming?daterange={daterange}&showmode={showmode}
     */
    getFlowAndNodeTime: function({ domainid, applicationid, daterange, showmode},{ onSucess, onError }){
        instance.get(`${contextPath}/authtime/domain/${domainid}/applicationid/${applicationid}/workflow/flowAndNodeTimeConsuming?daterange=${daterange}&showmode=${showmode}`).then(function (response){
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    /**
     * ### 13.4流程耗时占比
     **请求方式：** GET
     **请求地址：** /authtime/domain/{domainid}/applicationid/{applicationid}/workflow/flowTimeConsumingAccounting?daterange={daterange}&showmode={showmode}
     */
    flowTimeConsumingAccounting: function({ domainid, applicationid, daterange, showmode},{ onSucess, onError }){
        instance.get(`${contextPath}/authtime/domain/${domainid}/applicationid/${applicationid}/workflow/flowTimeConsumingAccounting?daterange=${daterange}&showmode=${showmode}`).then(function (response){
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    /**
     * ### 13.5流程实例占比
     **请求方式：** GET
     **请求地址：** /authtime/domain/{domainid}/applicationid/{applicationid}/workflow/flowAccounting?daterange={daterange}&showmode={showmode}
     */
    flowAccounting: function({ domainid, applicationid, daterange, showmode},{ onSucess, onError }){
        instance.get(`${contextPath}/authtime/domain/${domainid}/applicationid/${applicationid}/workflow/flowAccounting?daterange=${daterange}&showmode=${showmode}`).then(function (response){
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    /**
     * ### 13.6流程耗时排序
     **请求方式：** GET
     **请求地址：** /authtime/domain/{domainid}/applicationid/{applicationid}/workflow/doAnalyzerActorTimeConsumingTopX?daterange={daterange}&showmode={showmode}
     */
    doAnalyzerActorTimeConsumingTopX: function({ domainid, applicationid, daterange, showmode},{ onSucess, onError }){
        instance.get(`${contextPath}/authtime/domain/${domainid}/applicationid/${applicationid}/workflow/doAnalyzerActorTimeConsumingTopX?daterange=${daterange}&showmode=${showmode}`).then(function (response){
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    /**
     * ### 13.7查看流程实例信息
     **请求方式：** GET
     **请求地址：** /authtime/domain/applicationid/{applicationid}/workflow/flowstatert?id={id}
     */
    getFlowstatertsDetail: function(applicationid,id,{ onSucess, onError }){
        instance.get(`${contextPath}/authtime/domain/applicationid/${applicationid}/workflow/flowstatert?id=${id}`).then(function (response){
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    /**
     * ### 13.8获取可干预的节点
     **请求方式：** GET
     **请求地址：** /authtime/domain/applicationid/{applicationid}/workflow/intervention/othernodes?id={id}
     */
    getFlowOtherNodes: function(applicationid,id,{ onSucess, onError }){
        instance.get(`${contextPath}/authtime/domain/applicationid/${applicationid}/workflow/intervention/othernodes?id=${id}`).then(function (response){
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    /**
     * ### 13.9获取文档节点历史审批人
     **请求方式：** GET
     **请求地址：** /authtime/domain/applicationid/{applicationid}/workflow/intervention/approvers?id={id}&nodeid={nodeid}
     */
    getFlowPreUser: function(applicationid,id,nodeid,{ onSucess, onError }){
        instance.get(`${contextPath}/authtime/domain/applicationid/${applicationid}/workflow/intervention/approvers?id=${id}&nodeid=${nodeid}`).then(function (response){
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    /**
     * ### 13.10获取流程指定审批人用户选择框列表
     **请求方式：** GET
     **请求地址：** /authtime/domain/documents/{docId}/workflows/{flowId}/selectApprovers
     */
    getFlowUser: function(data,{ onSucess, onError }){
        instance.get(`${contextPath}/authtime/domain/documents/${data.docId}/workflows/${data.flowId}/selectApprovers?applicationId=${data.applicationId}&nodeId=${data.nodeId}&type=${data.type}&selectId=${data.selectId}&pageNum=${data.pageNum}&pageSize=${data.pageSize}`).then(function (response){
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    /**
     * ### 13.11干预流程
     **请求方式：** POST
     **请求地址：** /authtime/domain/applicationid/{applicationid}/workflow/intervention/flowstatert/doflow?id={id}&nextnodeids={nextnodeids} 
     */
    saveDoFlow: function(applicationid,id,nextnodeids,data,{ onSucess, onError }){
        instance.post(`${contextPath}/authtime/domain/applicationid/${applicationid}/workflow/intervention/flowstatert/doflow?id=${id}&nextnodeids=${nextnodeids} `,data).then(function (response){
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },


    /**
     * ### 13.9干预流程
     **请求方式：** GET
     **请求地址：** /authtime/domain/applicationid/{applicationid}/workflow/intervention/flowstatert/doflow?id={id}&nextnodeid={nextnodeid} 
     */
    saveFlowNode: function(applicationid,id,nextnodeid,{ onSucess, onError }){
        instance.get(`${contextPath}/authtime/domain/applicationid/${applicationid}/workflow/intervention/flowstatert/doflow?id=${id}&nextnodeid=${nextnodeid} `).then(function (response){
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },


    /**
     * ### 14.1获取域(租户)邮件配置
     **请求方式：** GET  
     **请求地址：** /authtime/domain/{domainid}/email
     */
    getEmailConfig: function ( domainid , { onSucess, onError }) {
        instance.get(`${contextPath}/authtime/domain/${domainid}/email`).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    /**
     * ### 14.2更新域(租户)邮件配置
     **请求方式：** PUT
     **请求地址：** /authtime/domain/{domainid}/email
     */
    updateEmailConfig: function (domainid, data, { onSucess, onError }) {
        instance.put(`${contextPath}/authtime/domain/${domainid}/email`, data).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    /**
     * ### 15.1上传文件
     **请求方式：** GET
     **请求地址：** /authtime/upload
     */
    fileUpload: function (file, { onSucess, onError }) {
        debugger
        instance.get(`${contextPath}/authtime/uploads`, file).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    /**
     * ### 16.1查询批量授权列表
     **请求方式：** GET
     **请求地址：** /authtime/applications/{appcationId}/permissions
     */
    getPermission: function ({applicationId}, { onSucess, onError }) {
        instance.get(`${contextPath}/authtime/applications/${applicationId}/permissions`).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    /**
     * ### 16.2批量更新授权配置
     **请求方式：** POST
     **请求地址：** /authtime/applications/{appcationId}/permissions
     */
    savePermission: function ({applicationId,data}, { onSucess, onError }) {
        instance.post(`${contextPath}/authtime/applications/${applicationId}/permissions`,data).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    /**
     * ### 16.3查询pc菜单配置资源列表(根据上级)
     **请求方式：** GET
     **请求地址：** /authtime/applications/{appcationId}/roles/{roleId}/permissions/pc?parentId={parentId}
     */
    getPCmenu: function ({applicationId,roleId,parentId}, { onSucess, onError }) {
        instance.get(`${contextPath}/authtime/applications/${applicationId}/permissions/pc?parentId=${parentId}&roleId=${roleId}`).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    /**
     * ### 16.4查询mobile菜单配置资源列表(根据上级)
     **请求方式：** GET
     **请求地址：** /authtime/applications/{appcationId}/roles/{roleId}/permissions/mobile?parentId={parentId}
     */
    getMobilemenu: function ({applicationId,roleId,parentId}, { onSucess, onError }) {
        instance.get(`${contextPath}/authtime/applications/${applicationId}/permissions/mobile?parentId=${parentId}&roleId=${roleId}`).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    /**
     * ### 16.5查询模块配置资源列表
     **请求方式：** GET
     **请求地址：** /authtime/applications/{appcationId}/permissions/module
     */
    getModuleList: function ({applicationId,parentId}, { onSucess, onError }) {
        instance.get(`${contextPath}/authtime/applications/${applicationId}/permissions/module?parentId=${parentId}`).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    /**
     * ### 16.6查询所属模块的表单或视图配置资源列表
     **请求方式：** GET
     **请求地址：** /authtime/applications/{applicationId}/modules/{moduleId}/permissions?roleId={roleId}
     */
    getModuleResource: function ({applicationId,roleId,moduleId}, { onSucess, onError }) {
        instance.get(`${contextPath}/authtime/applications/${applicationId}/modules/${moduleId}/permissions?roleId=${roleId}`).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },
    
    /**
     * ## 1.  **特权用户管理**
     * ### 1.1查询特权用户列表
     **请求方式：** GET
     **请求地址：** /authtime/superuser?name={name}&loginno={loginno}&currpage={currpage}&pagelines={pagelines}
     */
    getSuperUserList: function ({name,loginno,currpage,pagelines}, { onSucess, onError }) {
        instance.get(`${contextPath}/authtime/superuser?name=${name}&loginno=${loginno}&currpage=${currpage}&pagelines=${pagelines}`).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },
    
    /**
     * ### 1.2保存特权用户信息
     **请求方式：** PUT
     **请求地址：** /authtime/superuser/{id}
     */
    saveSuperUser: function ({id,data}, { onSucess, onError }) {
        instance.put(`${contextPath}/authtime/superuser/${id}`,data).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    /**
     * ### 1.3新建特权用户
     **请求方式：** POST
     **请求地址：** /authtime/superuser
     */
    createSuperUser: function ({data},{ onSucess, onError }) {
        instance.post(`${contextPath}/authtime/superuser`,data).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    /**
     * ### 1.4删除特权用户
     **请求方式：** DELETE
     **请求地址：** /authtime/superuser
     */
    deleteSuperUser: function ({data},{ onSucess, onError }) {
        instance.delete(`${contextPath}/authtime/superuser`,{data:data}).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },
    
    /**
     * ## 2.  **系统管理**
    */
    /**
     * ### ### 2.1获取配置信息
     **请求方式：** GET
     **请求地址：** /authtime/config
     */
    getConfig: function ({ onSucess, onError }) {
        instance.get(`${contextPath}/authtime/config`).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    /**
     * ### ### 2.2保存系统配置
     **请求方式：** PUT
     **请求地址：** /authtime/config
     */
    saveConfig: function ({data},{ onSucess, onError }) {
        instance.put(`${contextPath}/authtime/config`,data).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    /**
     * ### ### 2.3系统配置导入
     **请求方式：** POST
     **请求地址：** /authtime/config/import
     */
    importConfig: function (data,{ onSucess, onError }) {
        instance.post(`${contextPath}/authtime/config/import`,data).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    /**
     * ### ### 2.4系统配置导出
     **请求方式：** GET
     **请求地址：** /authtime/export
     */
    exportConfig: function (callback) {
        let url=`${contextPath}/authtime/config/export`
        window.open(url)
        callback();
    },

    /**
     * ### ### 2.5清楚冗余数据
     **请求方式：** POST
     **请求地址：** /authtime/config/cleardatas?applicationid={applicationid}
     */
    clearConfigId: function (applicationid,{ onSucess, onError }) {
        instance.post(`${contextPath}/authtime/config/cleardatas?applicationid=${applicationid}`).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },
    
    /**
     * ### ### 2.6清楚冗余数据
     **请求方式：** POST
     **请求地址：** /authtime/config/clearcache
     */
    clearConfig: function ({ onSucess, onError }) {
        instance.post(`${contextPath}/authtime/config/clearcache`).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },
    /**
     * ### ### 2.9获取清除缓存数据状态
     **请求方式：** GET
     **请求地址：** /authtime/config/cleardatas?applicationid={applicationid}
     */
    getClearConfigState: function ({ onSucess, onError }) {
        instance.get(`${contextPath}/authtime/config/clearcache/status`).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },
    /**
     * ### ### 2.7优化索引
     **请求方式：** GET
     **请求地址：** /authtime/domain/application/{applicationid}/optimization
     */
    indexOptimization: function (applicationid,{ onSucess, onError }) {
        instance.get(`${contextPath}/authtime/domain/application/optimization?applicationId=${applicationid}`).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    /**
     * ### ### 2.8同步环信用户
     **请求方式：** POST
     **请求地址：** /authtime/config/userstohx
     */
    userstohx: function ({ onSucess, onError }) {
        instance.post(`${contextPath}/authtime/config/userstohx`).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    /**
     * ### ### 3.1.获取在线用户
     **请求方式：** GET
     **请求地址：** /authtime/onlines？currpage={currpage}&pagelines={pagelines}&domainid={domainid}
     */
    getOnlineUser: function (currpage,pagelines,domainid,currentService,{ onSucess, onError }) {
        instance.get(`${contextPath}/monitor/${currentService.host}${currentService.contextPath}/${currentService.port}/authtime/onlines?currpage=${currpage}&pagelines=${pagelines}&domainid=${domainid}`).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    /**
     * ### 3.2.移除在线用户
     **请求方式：** DELETE
     **请求地址：** /authtime/onlines/{userId}
     * @param {*} param0 
     * @param {*} param1 
     */
    deleteOnlineUser: function (userId, currentService,{ onSucess, onError }) {
        instance.delete(`${contextPath}/monitor/${currentService.host}${currentService.contextPath}/${currentService.port}/authtime/onlines/${userId}`).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },


    /**
     * ### 17.1获取所有流程信息
     **请求方式：** GET  
     **请求地址：** /authtime/applications/{applicationId}/platform/flows?pageSize={pageSize}&pageNum={pageNum}
     */
    getAllFlowsInfo: function ({ applicationId, pageSize,pageNum}, { onSucess, onError }) {
        instance.get(`${contextPath}/authtime/domain/applications/${applicationId}/platform/flows?pageSize=${pageSize}&pageNum=${pageNum}`).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    /**
     * ### 17.2获取所有绑定软件用户信息
     **请求方式：** GET  
     **请求地址：** /authtime/domain/applications/{applicationId}/platform/allusers
     */
    getAllFlowsUser: function (applicationId, { onSucess, onError }) {
        instance.get(`${contextPath}/authtime/domain/applications/${applicationId}/platform/allusers`).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    /**
     * ### 发起流程(无接口文档,参照4.1编写)
     **请求方式：** post  
     **请求地址：** /authtime/domain/applications/{applicationId}/platform/allusers
     */
    startFlow: function ({applicationId,accessToken,userCode,flowId},data, { onSucess, onError }) {
        instance.post(`${contextPath}/rest/bpm/runtime/start?applicationId=${applicationId}&accessToken=${accessToken}&userCode=${userCode}&flowId=${flowId}`,data).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    /**
     * ### 17.3流程实例信息列表
     **请求方式：** GET  
     **请求地址：** /authtime/domain/applications/{applicationId}/platform/instance?pageSize={pageSize}&pageNum={pageNum}
     */
    getFlowsInsInfo: function ({ applicationId, pageSize,pageNum}, { onSucess, onError }) {
        instance.get(`${contextPath}/authtime/domain/applications/${applicationId}/platform/instance?pageSize=${pageSize}&pageNum=${pageNum}`).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    /**
     * ### 删除流程(无接口文档,参照4.1编写)
     **请求方式：** POST  
     **请求地址：** 
     */
    deleteFlow: function ({ applicationId, accessToken,docId}, { onSucess, onError }) {
        instance.get(`${contextPath}/rest/bpm/runtime/delete?applicationId=${applicationId}&accessToken=${accessToken}&docId=${docId}`).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    

    /**
     * ### 获取流程提交面板(无接口文档,参照4.1编写)
     **请求方式：** post  
     **请求地址：** 
     */
    submissionFlow: function ({ applicationId, accessToken,userCode,flowId,instanceId},data, { onSucess, onError }) {
        instance.post(`${contextPath}/rest/bpm/query/submission?applicationId=${applicationId}&accessToken=${accessToken}&userCode=${userCode}&flowId=${flowId}&instanceId=${instanceId}`,data).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },
    
    /**
     * ### 提交流程(无接口文档,参照4.1编写)
     **请求方式：** POST  
     **请求地址：** 
     */
    submitFlow: function ({ applicationId, accessToken,userCode,flowType,instanceId,comment,currNodeId,nextNodeIds},data, { onSucess, onError }) {
        instance.post(`${contextPath}/rest/bpm/runtime/submission?applicationId=${applicationId}&accessToken=${accessToken}&userCode=${userCode}&flowType=${flowType}&instanceId=${instanceId}&comment=${comment}&currNodeId=${currNodeId}&nextNodeIds=${nextNodeIds}`,data).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },
    
    /**
     * ### 获取流程回退面板(无接口文档,参照4.1编写)
     **请求方式：** POST  
     **请求地址：** 
     */
    backsionflow: function ({ applicationId, accessToken,userCode,instanceId}, { onSucess, onError }) {
        instance.post(`${contextPath}/rest/bpm/query/back?accessToken=${accessToken}&applicationId=${applicationId}&userCode=${userCode}&instanceId=${instanceId}`).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    /**
     * ### 回退流程(无接口文档,参照4.1编写)
     **请求方式：** POST  
     **请求地址：** 
     */
    backFlow: function ({ applicationId,flowId, accessToken,userCode,flowType,instanceId,comment,currNodeId,nextNodeIds},data, { onSucess, onError }) {
        instance.post(`${contextPath}/rest/bpm/runtime/back?applicationId=${applicationId}&flowId=${flowId}&accessToken=${accessToken}&userCode=${userCode}&flowType=${flowType}&instanceId=${instanceId}&comment=${comment}&currNodeId=${currNodeId}&nextNodeIds=${nextNodeIds}`,data).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },
    /**
     * ### 回撤流程(无接口文档,参照4.1编写)
     **请求方式：** POST  
     **请求地址：** 
     */
    retraceflow: function ({ applicationId, accessToken,userCode,instanceId},data, { onSucess, onError }) {
        instance.post(`${contextPath}/rest/bpm/runtime/retracement?accessToken=${accessToken}&applicationId=${applicationId}&userCode=${userCode}&instanceId=${instanceId}`,data).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    /**
     * ### ### 系统监控-获取服务
     **请求方式：** GET
     **请求地址：** http://localhost/manager/api/authtime/system/services
     */
    getSystemMoniServices: function ({ onSucess, onError }) {
        instance.get(`${contextPath}/authtime/system/services`).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    
    /**
     * ### ### 系统监控 echart数据
     **请求方式：** GET
     **请求地址：** /obpm/systemMonitor
     */
    getEchartsData: function (time,currentService,{ onSucess, onError }) {
        instance.get(`${contextPath}/monitor/${currentService.host}${currentService.contextPath}/${currentService.port}/systemMonitor?time=${time}`).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    /**
     * ### ### 系统监控 echart数据
     **请求方式：** GET
     **请求地址：** /system/monitor/time
     */
    getEchartsDataStep: function (currentService,{ onSucess, onError }) {
        instance.get(`${contextPath}/monitor/${currentService.host}${currentService.contextPath}/${currentService.port}/system/monitor/time`).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    /**
     * ### ### jamen
     **请求方式：** GET
     **请求地址：** /system/monitor/time
     */
    getjamenList: function (enableAll,currentService,{ onSucess, onError }) {
        instance.get(`${contextPath}/monitor/${currentService.host}${currentService.contextPath}/${currentService.port}/authtime/jamon/menu?enableAll=${enableAll}`).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },


    /**
     * ### ### jamenAdmin
     **请求方式：** POST
     **请求地址：** /authtime/jamon/jamonAdminInfo
     */
    getjamenAdmin: function ({data},currentService,{ onSucess, onError }) {
        console.log(contextPath,'contextPath')
        //http://localhost:8086/manager/api
        //?contextPath=${currentService.contextPath}&port=${currentService.port}&host=${currentService.host
        instance.post(`${contextPath}/monitor/${currentService.host}${currentService.contextPath}/${currentService.port}/authtime/jamon/jamonAdminInfo`,data).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    /**
     * ### ### swagger按角色获取用户列表
     **请求方式：** GET
     **请求地址：** /authtime/swagger/getuserlistbyrole?currpage={currpage}&pagelines={pagelines}&roleid={roleid}&domainid={domainid}
     */
    getUserListbyRole: function({currpage, pagelines, roleid, domainid}, { onSucess, onError }) {
        instance.get(`${contextPath}/authtime/swagger/getuserlistbyrole?currpage=${currpage}&pagelines=${pagelines}&roleid=${roleid}&domainid=${domainid}`).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    /**
     * ### ### swagger登陆
     **请求方式：** POST
     **请求地址：** /authtime/swagger/login?userid={userid}
     */
    swaggerLogin: function(userid,currentService,{ onSucess, onError }) {
        instance.post(`${contextPath}/monitor/${currentService.host}${currentService.contextPath}/${currentService.port}/authtime/swagger/login?userid=${userid}`).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },

    /**
     * ### ### swagger注销
     **请求方式：** POST
     **请求地址：** /authtime/swagger/logout
     */
    swaggerLogOut: function(currentService,{ onSucess, onError }) {
        instance.post(`${contextPath}/monitor/${currentService.host}${currentService.contextPath}/${currentService.port}/authtime/swagger/logout`).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },
    
    /**
     * ### ### 授权时（管理员） 2。10 *同步软件的数据表单**
     **请求方式：** POST
     **请求地址：** /runtime/synchronization/forms?applicationId={applicationId}
     */
    synchronization: function(applicationId,{ onSucess, onError }) {
        instance.post(`${contextPath}/authtime/synchronization/forms?applicationId=${applicationId}`).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },
     /**
     * ### ### 授权时（管理员） 2.11 *同步软件的数据表单**
     **请求方式：** POST
     **请求地址：** /runtime/synchronization/forms?applicationId={applicationId}
     */
    getSynchronizationState: function(applicationId,{ onSucess, onError }) {
        instance.get(`${contextPath}/authtime/synchronization/forms/status?applicationId=${applicationId}`).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },
    /**
     * ### ### 授权时6.11导出角色&菜单权限关系
     **请求方式：** GET
     **请求地址：** /authtime/applications/{applicationid}/exportrolemenuauthority
     */
    exportrolemenuauthority: function(applicationId) {
        window.open(`${contextPath}/authtime/domain/applications/${applicationId}/exportrolemenuauthority`)
    },
    /**
     * ### ### 授权时6.11导出角色&菜单权限关系
     **请求方式：** GET
     **请求地址：** /authtime/applications/{applicationid}/exportrolemenuauthority
     */
    exportroleuserauthority: function(applicationId, domainId) {
        window.open(`${contextPath}/authtime/domain/${domainId}/applications/${applicationId}/exportroleuserauthority`)
    },
    /**
     * ### ### 授权时6.11导出基础数据
     **请求方式：** GET
     **请求地址：** /api/authtime//domain/{domainId}/applications/{applicationId}/data/export
     */
     exportbasicdataauthority: function(applicationId, domainId) {
        window.open(`${contextPath}/authtime/domain/${domainId}/applications/${applicationId}/data/export`)
    },
     /**
     * ### ### 授权时（管理员） 7.1.获取当前登录用户
     **请求方式：** get
     **请求地址：** /authtime/myprofile
     */
    getCurrentUser: function({ onSucess, onError }) {
        instance.get(`${contextPath}/authtime/myprofile`).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },
    /**
     * ### ### 17.2启动定时任务
     **请求方式：** PUT
     **请求地址：** /api/authtime/domain/task/start
     */
    startTask: function(data,{ onSucess, onError }) {
        instance.put(`${contextPath}/authtime/domain/applications/${data.applicationid}/tasks/${data.id}/start?rTime=${data.rTime}&rDate=${data.rDate}`).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },
    /**
     * ### ### 17.3停止定时任务
     **请求方式：** PUT
     **请求地址：** /api/authtime/domain/task/stop
     */
    stopTask: function(data,{ onSucess, onError }) {
        instance.put(`${contextPath}/authtime/domain/applications/${data.applicationid}/tasks/${data.id}/stop`).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },
    /**
     * ### ### 17.4 获取绑定软件的定时任务
     **请求方式：** POST
     **请求地址：**  /api/authtime/domain/tasks?searchword={searchword}&linesPerPage={linesPerPage}&pageNo={pageNo}
     */
    getTaskList: function(params, data, { onSucess, onError }) {
        instance.post(`${contextPath}/authtime/domain/tasks?searchword=${params.searchword}&linesPerPage=${params.linesPerPage}&pageNo=${params.pageNo}`, data).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },
     /**
     * ### 18.1获取飞书配置
     **请求方式：** GET  
     **请求地址：** /authtime/domain/{domainid}/feishu
     * @param {*} param0 
     */
     getFeiShuConfig: function ({ domainid }, { onSucess, onError }) {
        instance.get(`${contextPath}/authtime/domain/${domainid}/feishu`).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },
     /**
     * ### 18.2保存飞书配置
     **请求方式：** PUT
     **请求地址：** /authtime/domain/{domainid}/feishu
     * @param {*} param0 
     * @param {*} param1 
     */
     updateFeiShuConfig: function ({ domainid, data }, { onSucess, onError }) {
        instance.put(`${contextPath}/authtime/domain/${domainid}/feishu`, data).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },
    /**
     * ### 18.3飞书外网访问地址验证
     **请求方式：** GET  
     **请求地址：** /authtime/domain/{domainid}/feishu/appkey/{appkey}/appsecret/{appsecret}
     * @param {*} param0 
     * @param {*} param1 
     */
     verifyFeiShuConfig: function ({ domainid, appkey, appsecret }, { onSucess, onError }) {
        instance.get(`${contextPath}/authtime/domain/${domainid}/feishu/appkey/${appkey}/appsecret/${appsecret}`).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },
     /**
     * ### 18.4同步域(租户)组织架构到飞书
     **请求方式：** PUT
     **请求地址：** /authtime/domain/{domainid}/synch2feishu
     * @param {*} param0 
     * @param {*} param1 
     */
     sync2FeiShu: function ({ domainid }, { onSucess, onError }) {
        instance.put(`${contextPath}/authtime/domain/${domainid}/synch2feishu`).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },
     /**
     * ### 18.5同步企业域组织架构到飞书
     **请求方式：** PUT
     **请求地址：** /authtime/domain/{domainid}/synchfromfeishu   
     * @param {*} param0 
     */
     synFromFeiShu: function ({ domainid}, { onSucess, onError }) {
        instance.put(`${contextPath}/authtime/domain/${domainid}/synchfromfeishu`).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },
   
    /**
     * ### 18.6生成跳转链接
     **请求方式：** GET  
     **请求地址 :******** 
     /domain/{domainid}/application/{applicationid}/getfeishuurl/appid/{appid}
     * @param {*} param0 
     * @param {*} param1 
     */
     genFeishuURL: function ({ domainid ,applicationid,appid }, { onSucess, onError }) {
        instance.get(`${contextPath}/authtime/domain/${domainid}/application/${applicationid}/getfeishuurl/appid/${appid}`).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },
     /**
     * ### 18.7更新飞书应用AppId
     **请求方式：** PUT  
     **请求地址 :******** /authtime/domain/{domainid}/application/{applicationid}/updatefeishuappId?id={id}
     * @param {*} param0 
     * @param {*} param1 
     */
     saveFeishuAppKey: function ({ domainid ,applicationid,id}, { onSucess, onError }) {
        instance.put(`${contextPath}/authtime/domain/${domainid}/application/${applicationid}/updatefeishuappId?id=${id}`).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },
     /**
     * ### 18.8更新飞书应用appSecret
     **请求方式：** PUT  
     **请求地址 :******** /authtime/domain/{domainid}/application/{applicationid}/updatefeishusecret?appsecret={secret}
     * @param {*} param0 
     * @param {*} param1 
     */
     saveFeishuAppSecret: function ({ domainid ,applicationid,secret}, { onSucess, onError }) {
        instance.put(`${contextPath}/authtime/domain/${domainid}/application/${applicationid}/updatefeishuappsecret?appsecret=${secret}`).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },
      /**
     * 19.1获取域(租户)云能力
     * /api/authtime/domain/{id}/services
     */
    getCloudDomain: function (id, { onSucess, onError }) {
        instance.get(`${contextPath}/authtime/domain/${id}/cloudcenter/services`).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },
      /**
     * ### 19.2 云能力账号保存
     **请求方式：** POST  
     **请求地址：** /api/authtime/domain/{id}/cloudcenter/user
     */
     updateCloudDomain: function (id, data, { onSucess, onError }) {
        instance.post(`${contextPath}/authtime/domain/${id}/cloudcenter/user`, data).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },
     /**
     * ### 获取应用管理列表
     **请求方式：** POST  
     **请求地址：** /authtime/domain/${id}/wechat/agents
     */
     wechatAgents: function (id,{ onSucess, onError }) {
        instance.get(`${contextPath}/authtime/domain/${id}/wechat/agents`).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },
     /**
     * ### 获取应用管理详情
     **请求方式：** GET  
     **请求地址：** /authtime/domain/${id}/wechat/agents
     */
     wechatAgentsDetail: function (id,agentsId,{ onSucess, onError }) {
        instance.get(`${contextPath}/authtime/domain/${id}/wechat/agents/${agentsId}`).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },
    /**
     * ### 获取企业微信菜单列表
     **请求方式：** GET  
     **请求地址：** /authtime/domain/{domainid}/wechat/agents/{agentid}/menus
     */
    getWechatMenus: function (id,agentsId,{ onSucess, onError }) {
        instance.get(`${contextPath}/authtime/domain/${id}/wechat/agents/${agentsId}/menus`).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },
    /**
     * ### 创建/更新/删除企业微信菜单
     **请求方式：** POST  
     **请求地址：** /authtime/domain/{domainid}/wechat/agents/{agentid}/menus
     */
    creatWechatMenus: function (id,agentsId,data,{ onSucess, onError }) {
        instance.post(`${contextPath}/authtime/domain/${id}/wechat/agents/${agentsId}/menus`,data).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },
    /**
     * ### 获取企业微信标签列表
     **请求方式：** GET  
     **请求地址：** /authtime/domain/{domainid}/wechat/tags
     */
    getWechatTags: function (id,{ onSucess, onError }) {
        instance.get(`${contextPath}/authtime/domain/${id}/wechat/tags`).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },
    /**
     * ### 创建企业微信标签列表
     **请求方式：** POST  
     **请求地址：** /authtime/domain/{domainid}/wechat/tags
     */
    CreatWechatTags: function (id,data,{ onSucess, onError }) {
        instance.post(`${contextPath}/authtime/domain/${id}/wechat/tags`,data).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },
    /**
     * ### 删除企业微信标签
     **请求方式：** DELETE  
     **请求地址：** /api/authtime/domain/{domainid}/wechat/tags/{tagid}
     */
    deleteWechatTags: function (id,tagId,{ onSucess, onError }) {
        instance.delete(`${contextPath}/authtime/domain/${id}/wechat/tags/${tagId}`).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },
    /**
     * ### 获取企业微信标签成员
     **请求方式：** GET  
     **请求地址：**  /api/authtime/domain/{domainid}/wechat/tags/{tagid}/members
     */
    getWechatTagsMembers: function (id,tagId,{ onSucess, onError }) {
        instance.get(`${contextPath}/authtime/domain/${id}/wechat/tags/${tagId}/members`).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },
    /**
     * ### 移除企业微信标签成员
     **请求方式：** DELETE  
     **请求地址：**  /api/authtime/domain/{domainid}/wechat/tags/members
     */
    deleteWechatTagsMembers: function (id,data,{ onSucess, onError }) {
        instance.delete(`${contextPath}/authtime/domain/${id}/wechat/tags/members`,data).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },
    /**
     * ### 获取企业微信标签列表
     **请求方式：** PUT  
     **请求地址：** /authtime/domain/{domainid}/wechat/tags
     */
    updateWechatTags: function (id,data,{ onSucess, onError }) {
        instance.put(`${contextPath}/authtime/domain/${id}/wechat/tags`,data).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },
    /**
     * ### 获取企业微信标签部门成员列表
     **请求方式：** GET  
     **请求地址：** /api/authtime/domain/3CffNlgt9B9StIjIUPB/wechat/organizations?parentid=1
     */
    getWechatOrganizations: function (id,parentid,{ onSucess, onError }) {
        instance.get(`${contextPath}/authtime/domain/${id}/wechat/organizations?parentid=${parentid}`).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },
     /**
     * ### 添加企业微信标签成员
     **请求方式：** POST  
     **请求地址：** /api/authtime/domain/{domainid}/wechat/tags/members
     */
    addWechatMembers: function (id,data,{ onSucess, onError }) {
        instance.post(`${contextPath}/authtime/domain/${id}/wechat/tags/members`,data).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },
    /**
     * ### 获取企业微信临时素材列表
     **请求方式：** GET  
     **请求地址：** /api/authtime/domain/{domainid}/wechat/medias
     */
    getMediasList: function (id,type,{ onSucess, onError }) {
        instance.get(`${contextPath}/authtime/domain/${id}/wechat/medias?type=${type}`).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },
    /**
     * ### 上传企业微信临时素材
     **请求方式：** POST  
     **请求地址：** /api/authtime/domain/{domainid}/wechat/medias/upload?type={type}
     */
    uploadMedias: function (id,type,data,{ onSucess, onError }) {
        instance.post(`${contextPath}/authtime/domain/${id}/wechat/medias/upload?type=${type}`,data).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },
    /**
     * ### 下载企业微信临时素材
     **请求方式：** GET  
     **请求地址：**  /api/authtime/domain/{domainid}/wechat/medias/{mediaid}/download?fileName={fileName}
     */
    downloadMedias: function (id,mediaid,fileName,{ onSucess, onError }) {
        instance.get(`${contextPath}/authtime/domain/${id}/wechat/medias/${mediaid}/download?fileName=${fileName}`).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },
    /**
     * ### 删除企业微信临时素材
     **请求方式：** GET  
     **请求地址：**  /api/authtime/domain/{domainid}/wechat/medias
     */
    deleteMedias: function (id,data,{ onSucess, onError }) {
        instance.delete(`${contextPath}/authtime/domain/${id}/wechat/medias`,{data}).then(function (response) {
            if (onSucess) onSucess(response);
        }).catch(
            function (error) {
                if (onError) onError(error);
            }
        );
    },
};
